Skip to content

fix: filter out null objects in mergeNodeTemplates function - #12688

Merged
erichare merged 4 commits into
langflow-ai:release-1.10.0from
paulina-grunwald:issue-12667-group-agent-components
Apr 16, 2026
Merged

fix: filter out null objects in mergeNodeTemplates function#12688
erichare merged 4 commits into
langflow-ai:release-1.10.0from
paulina-grunwald:issue-12667-group-agent-components

Conversation

@paulina-grunwald

@paulina-grunwald paulina-grunwald commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

This PR fixes issue mentioned in #12667.

Summary

  • Fixes Can't group Agent components #12667 — grouping Agent and Language Model components crashes with Cannot create property 'proxy' on boolean 'true'
  • Some components (e.g. Agent, Language Model) have primitive boolean fields in their template (like is_refresh). The mergeNodeTemplates function assumed all template values are objects and crashed when trying to set .proxy on a boolean.
    Added a filter to skip non-object template fields before iterating, matching the existing pattern that filters out _-prefixed fields.

Before:

before.mov

After:

after.grouping.mov

Detailed steps to reproduce

  1. open new blank template
  2. add lanuage model and agent
  3. Group Language Model + Agent (connected) — it works
  4. ungroup components
  5. Refresh page.
  6. group again - shows error in console and doesnt work

Summary by CodeRabbit

  • Bug Fixes
    • Strengthened template field validation to exclude non-object or null values during merging, ensuring data integrity and preventing potential processing errors.

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8962da3f-414f-4e0d-8924-311ef5072816

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The mergeNodeTemplates function in the reactflow utilities now includes an additional non-null object type check when filtering template fields before merging them into the resulting template object.

Changes

Cohort / File(s) Summary
Node Template Merge Logic
src/frontend/src/utils/reactflowUtils.ts
Added non-null object type check in mergeNodeTemplates field-selection pipeline to exclude entries where nodeTemplate[field_name] is not a non-null object, beyond the existing internal key filtering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR includes a bug fix for mergeNodeTemplates function but lacks regression tests and no test files were added or modified. Add unit tests in src/frontend/src/utils/tests/mergeNodeTemplates.test.ts covering the null/non-object filter fix and enable group.spec.ts tests.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning No unit tests found for mergeNodeTemplates function changes that filter non-object template fields. Add comprehensive unit tests covering merging behavior, primitive field filtering, and edge cases for the mergeNodeTemplates function.
Test File Naming And Structure ⚠️ Warning PR modifies critical mergeNodeTemplates function but lacks corresponding test file despite repository's clear testing pattern for frontend utilities. Create test file src/frontend/src/utils/tests/reactflowUtils.test.ts with comprehensive tests for mergeNodeTemplates covering filtering, merging, edge cases, and the Agent/Language Model grouping scenario.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: filtering out null objects in the mergeNodeTemplates function to prevent crashes when grouping components with primitive boolean fields.
Excessive Mock Usage Warning ✅ Passed The PR makes a minimal bug fix to mergeNodeTemplates by filtering non-object template fields before processing, without adding or modifying tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the bug Something isn't working label Apr 14, 2026
@paulina-grunwald
paulina-grunwald marked this pull request as ready for review April 14, 2026 09:24
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 14, 2026
@erichare
erichare self-requested a review April 16, 2026 18:30
@erichare
erichare changed the base branch from main to release-1.10.0 April 16, 2026 18:31
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 16, 2026

@erichare erichare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulina-grunwald Thank you for this! Nice work.

@erichare
erichare enabled auto-merge April 16, 2026 18:37
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 16, 2026
@erichare erichare added the fast-track Skip tests and sends PR into the merge queue label Apr 16, 2026
@erichare
erichare added this pull request to the merge queue Apr 16, 2026
@erichare
erichare removed this pull request from the merge queue due to a manual request Apr 16, 2026
@erichare
erichare added this pull request to the merge queue Apr 16, 2026
Merged via the queue into langflow-ai:release-1.10.0 with commit abc6bad Apr 16, 2026
112 of 115 checks passed
erichare added a commit that referenced this pull request Apr 24, 2026
* fix: filter out null objects in mergeNodeTemplates function

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Hare <ericrhare@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fast-track Skip tests and sends PR into the merge queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't group Agent components

2 participants